package football.haha.com.footballtv.utils;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.widget.Toast;

/**
 * Created by oo on 2017/9/11.
 */

public class ActivityUtils {

    public static boolean isLogin(Context context, boolean gotoLogin){
        boolean isLogin = ShareTools.getBooleanPreference(context, "IsLogin");
        if (isLogin) {
            return true;
        }else{
            if (gotoLogin){
                Toast.makeText(context, "请先登录", Toast.LENGTH_LONG).show();
//                gotoActivity(context, LoginActivity.class);
            }
        }
        return false;
    }

    public static void gotoActivity(Context context, Class activityClass){
        Intent intent = new Intent(context, activityClass);
        context.startActivity(intent);
    }

    public static void gotoActivityForResult(Activity activity, Class activityClass, int requestCode){
        Intent intent = new Intent(activity, activityClass);
        activity.startActivityForResult(intent, requestCode);
    }

    public static void gotoActivityWithIntent(Context context, Intent intent){
        context.startActivity(intent);
    }

}
